home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Leonardo the Inventor
/
Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso
/
LEOWINMV
/
DATABASE.DIR
/
00102_Script_General Handlers
< prev
next >
Wrap
Text File
|
1996-03-28
|
2KB
|
70 lines
-- --------------------------------------------------------------
-- Handler validNum
on validNum theNum, theMin, theMax
if theNum < theMin then return theMin
else if theNum > theMax then return theMax
else return theNum
end
-- --------------------------------------------------------------
-- Handler sortLines returns the given source sorted.
on sortLines source
set out = []
set numLines = the number of lines of source
repeat with L = 1 to numLines
add(out, line L of source)
end repeat
sort out
set sorted = ""
repeat with L = 1 to numLines
put getAt (out, L) & RETURN after sorted
end repeat
return sorted
end
-- --------------------------------------------------------------
-- Handler reverseFirstAndSecondItems returns the given source
-- with the first and second items switched.
on reverseFirstAndSecondItems source
set out = ""
set the itemdelimiter = ":"
repeat with L = 1 to the number of lines of source
put (item 2 of line L of source) & ":" & (item 1 of line L of source) & RETURN after out
end repeat
set the itemdelimiter = ","
return out
end
-- --------------------------------------------------------------
-- Handler sortInReverseOrder
on sortInReverseOrder dataField
set dataList = []
set tempVar = field datafield
repeat with i = 1 to the number of lines in tempVar
add(dataList, line i of tempVar)
end repeat
sort dataList
set reverseSort = []
set tempVar = EMPTY
set lineNumber = 1
repeat with i = count(dataList) down to 1
put getAt(dataList,i) into line lineNumber of tempVar
set lineNumber = lineNumber + 1
end repeat
put tempVar into field datafield
set tempVar = empty
end